package com.example.fitness.analysis;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;

import org.achartengine.chart.PointStyle;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;



public abstract class ChartBuilder {
	/** Colors to be used for the pie slices. */
	protected int[] COLORS;	

	public PointStyle[] getPointStyles() {
		return PointStyle.values();
	}
	public Date[] getDates(Date start) {
		ArrayList<Date> dates = new ArrayList<Date>();
		Calendar current = Calendar.getInstance();
		Calendar s = Calendar.getInstance();
		s.setTime(start);
		while(s.before(current)) {
			s.add(Calendar.DAY_OF_YEAR, 1);
			dates.add(s.getTime());
		}
		return (Date[]) dates.toArray();
	}
	public void getColors(int numOfColors) {
		Date d = new Date();
		long seed = d.getTime();
		Random rand = new Random(seed);
		int[] colors = new int[numOfColors];
		for(int i = 0; i < numOfColors; i++) {
			int red = rand.nextInt(256);
			int green = rand.nextInt(256);
			int blue = rand.nextInt(256);
			colors[i] = Color.rgb(red, green, blue);
		}
		this.COLORS = colors;
	}
	
	public abstract Intent getChartIntent(Context context, String[] series, double[] values);
}